#include "../include/CardSet.h"
#include "../include/CCard.h"


/*****************************************************************************/
/**                              class CCardSet                             **/
/*****************************************************************************/

void CCardSet::sortCards(SortType st)
{
    if (st == stValue)
        sort(mCards.begin(), mCards.end(), cmpByValue);
    else
        sort(mCards.begin(), mCards.end(), cmpBySuit);
}

string CCardSet::getSignature() const
{
    vector<CCard> lCards(mCards);
    sort(lCards.begin(), lCards.end(), cmpByValue);

    string result;
    for (const CCard& card: lCards)
        result += CardValueToChar(card.getValue());

    return result;
}

ostream& operator << (ostream& ostr, const CCardSet& cardSet)
{
    for (const CCard& card: cardSet)
        ostr << card << " ";
    return ostr;
}

/*****************************************************************************/
/**                                class CHand                              **/
/*****************************************************************************/

ostream& operator << (ostream& ostr, const CHand& hand)
{
    for (const CCard& card: hand)
        ostr << card << " ";
    return ostr;
}

/*****************************************************************************/
/**                                class CHand                              **/
/*****************************************************************************/

CCardStrengthCalculator CHand::mStrenghtCalc;
CCombination CHand::mCombinationCalc;

